How to Delete Cookies
Description
Cookies can be deleted by specifying their expiration date.
Discussion
You cannot directly delete a cookie on a user's computer. To remove a cookie, you must set the cookie's expiration date and time to a time in the past. The browser will then remove the cookie the next time a request is made and the cookie is inspected.
dim cookieName as c cookieName = "CustomCookie" if Context.Request.HasCookie(cookieName) then dim cookie as System::Web::HttpCookie = Context.Request.GetCookie(cookieName) cookie.HttpOnly = .t. cookie.Expires = ctodt("1/1/1970 12:00:00 00 am") Context.Response.AppendCookie(cookie) end if
The expiration time is the time on the client that the cookie expires.
See Also